{extend name="layout/iframe" /}
{block name="pagecss"}
<style>
    .layui-form-select .layui-input{
        padding-right: 0;
        cursor: pointer;
    }
    input::-webkit-input-placeholder {
        text-align:right;
    }
</style>
{/block}
{block name="content"}
<div class="layui-card-body layui-layout-admin" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="component-form-group">

        <div class="layui-col-md3 layui-col-xs5 layui-form-item" style="margin-left: 110px;">
            <div id="upload-image">
                <div class="layui-upload-list thumbBox mag0 magt3" id="upload-btn" data-multi="false">
                    <input type="hidden" class="layui-input" name="title_url" value="{$info.title_url}">
                    <img class="layui-upload-img thumbImg" src="{$info.title_url}">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>活动主题</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" value="{$info.name}" name="name" lay-verify="required" placeholder="请输入" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>副标题</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="f_name" value="{$info.f_name}" lay-verify="required" placeholder="请输入" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>推送对象</label>
            <div class="layui-input-block">
                <select  name="coupon_purpose" lay-verify="required">
                    <option value="1">所有会员</option>
                    {foreach $member_level as $v}
                    <option value="{$v.id}" {if $v.id == $info.coupon_purpose} selected {/if}>{$v.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span class="required">*</span>开始日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="start_time" value="{$info.start_time|substr=0,10}" name="start_time" lay-verify="required" placeholder="yyyy-MM-dd">
            </div>　　
            <label class="layui-form-label" style="width: 20%"><span class="required">*</span>结束日期</label>
            <div class="layui-input-inline" >
                <input type="text" class="layui-input" id="end_time" value="{$info.end_time|substr=0,10}" name="end_time" lay-verify="required" placeholder="yyyy-MM-dd">
            </div>
        </div>

        <div class="layui-col-md3 layui-col-xs5 layui-form-item" style="margin-left: 110px;">
            <div id="upload-image2">
                <div class="layui-upload-list thumbBox mag0 magt3" id="upload-btn2" data-multi="false">
                    <input type="hidden" class="layui-input" name="detail_url" value="{$info.detail_url}">
                    <img class="layui-upload-img thumbImg" src="{$info.detail_url}">
                </div>
            </div>
        </div>

        <div class="layui-form-item ">
            <label class="layui-form-label" >插入优惠券</label>
            <input type="checkbox" name="is_coupon" checked=""  lay-skin="switch" lay-text="启用|不启用">
            <div class="layui-unselect layui-form-switch is-coupon-btn" id="coupon" lay-skin="_switch"><em>启用</em><i></i></div>
        </div>


        <div class="layui-form-item is_coupon">
            <label class="layui-form-label">选择活动卷</label>

            <div class="layui-unselect layui-form-select downpanel cs layui-input-block">
                <div class="layui-select-title">
                    <input type="text" placeholder="请选择优惠券" {if $info.coupon_count != 0} value="已选择 {$info.coupon_count} 张优惠券" {/if} readonly="" class="layui-input layui-unselect couponNumber"><i class="layui-edge"></i>
                </div>
                <dl class="layui-anim layui-anim-upbit" style="">
                    {foreach $member_coupon as $v}
                    <dd><input type="checkbox" name="coupon_id[]" title="{$v.name}" value="{$v.id}"  lay-skin="primary" {if in_array($v.id,$info.coupon_id)} checked {/if} ></dd>
                    {/foreach}
                </dl>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label" >插入商品</label>
            <input type="checkbox" name="is_product" checked=""  lay-skin="switch" lay-text="启用|不启用">
            <div class="layui-unselect  layui-form-switch" lay-skin="_switch"><em>启用</em><i></i></div>　
        </div>


        <div class="payment-rule">
            <div class="payment-rule-group">
                {foreach $info.product as $k => $v}
                <div class="layui-form-item layui-form-text rule-group">
                    <div class="layui-inline">
                        <label class="layui-form-label">商品 {$k+1}</label>
                    <div class="layui-input-inline">
                    <input type="hidden" class="layui-input " name="pro_id[]" value="{$v.id}" maxlength="10" autocomplete="off">
                        <div style="line-height: 39px; width: 300px">{$v.name}</div>
                    </div>
                </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <button type="button" class="layui-btn layui-btn-danger delRule-btn "><i class="layui-icon layui-icon-delete"></i></button>
                    </div>
                </div>
            </div>
                {/foreach}
        </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-inline">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <button type="button" class="layui-btn layui-btn-normal addPro-btn"><i class="layui-icon"></i>新增商品</button>
                    </div>
                </div>
            </div>
        <div class="layui-form-item layui-row layui-col-xs12">
            <div class="layui-input-block">
            <div class="layui-footer">
                <button type="button" class="layui-btn layui-btn-primary close-btn">取消</button>
                <button class="layui-btn" type="button" lay-submit="" lay-filter="laySave">保存 <i class="layui-icon">&#xe609;</i></button>
            </div>
            </div>
        </div>
        </div>
        <input type="hidden" name="id" value="{$info.id}">
    </form>
</div>


<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">
<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/addpost')}">
<input type="hidden" class="handle_url" value="{:url('admin/'.strtolower($model).'/handle')}">
<input type="hidden" class="get_product_url" value="{:url('admin/'.strtolower($model).'/get_product')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>


<script src="__STATIC__/admin/pages/js/activity.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/uploadfile02.js" type="text/javascript"></script>
{/block}